﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using FOModels.Product;
using Bussiness.Product;
using Bussiness.News;
using Bussiness.BlogNews;
using Bussiness.Language;
using FOModels.Language;
using FOModels.BlogNews;
using System.Data;
namespace FOSystem.Utility
{
    public static class ConfigHelper
    {
        public static int CountNewsByCate(int productid)
        {
            int count = 0;
            NewsBLL bll = new NewsBLL();
            count = bll.getCoutNewsByCate(productid).Count();
            return count;
        }
        public static int CountBlogNewsByCate(int blognewcateid,int langid)
        {
            int count = 0;
            BlogNewsBLL bll = new BlogNewsBLL();
            count = bll.getBlogNewByCate(blognewcateid,langid).Count();
            return count;
        }
        /*
        public List<BlogNewsCategoryModels> ResposiBlogNewsCategoryManagerExViewByCate(int BlogNewsCategoryID, int langid)
        {
            List<BlogNewsCategoryModels> list = new List<BlogNewsCategoryModels>();
            BlogNewsCategoryModels fur;
            DataTable tb = dal.ResposiBlogNewsCategoryManagerExViewByCate(BlogNewsCategoryID, langid);
            if (tb != null && tb.Rows.Count > 0)
            {
                foreach (DataRow row in tb.Rows)
                {
                    fur = new BlogNewsCategoryModels();
                    fur.BlogNewsCategoryID = int.Parse(row["BlogNewsCategoryID"].ToString());
                    fur.Enable = bool.Parse(row["Enable"].ToString());
                    fur.BlogNewsCategoryName = row["BlogNewsCategoryName"].ToString();
                    fur.ParentID = int.Parse(row["ParentID"].ToString());
                    list.Add(fur);
                }
            }
            return list;
        }
         * */
        public static FOModels.User.User seacrhUser(string email)
        {
            FOModels.User.User us = null;
            try
            {
                Fcom.IDLib.SaveMoneyID.AccountsynClient client = new Fcom.IDLib.SaveMoneyID.AccountsynClient();
                Fcom.IDLib.SaveMoneyID.FullUserInfo fullinfo = client.getUserInfo(email);
                us = new FOModels.User.User();
                us.DisplayName = fullinfo.Fullname;
                us.Email = fullinfo.Email;
                us.GroupID = fullinfo.GroupID;
                us.Status = fullinfo.Status;
                us.Username = fullinfo.Username;

            }
            catch
            {
                us = null;
            }
            return us;
        }

    }
}